import {nextTick} from 'vue';

export default {
    name: 'permission',
    mounted(el, binding) {

        init(el, binding);
    },
    updated(el, binding) {

        init(el, binding);
    }
};

function init(el, binding) {
    const value = binding.value;
    if (value === false) {
        // 使用 nextTick 确保 DOM 更新完成后再执行删除操作
        nextTick(() => {
            if (el.parentNode) {
                el.parentNode.removeChild(el);
            }
        }).then(r => {
        });
    }
}